# Purpose: Produce tables that summarize our samples of users

source("constants.R")

#############################################
# 1. Summary stats for natives and migrants #
#############################################

# This produces Table 1

# See the README for instructions on how to access these data
syrian_sample_summary_stats <- read_csv("input/pipeline/individual_summary_stats_syrians.csv")
native_sample_summary_stats <- read_csv("input/pipeline/individual_summary_stats_natives.csv")

write_csv(syrian_sample_summary_stats, "output/syrian_sample_summary.csv")
write_csv(native_sample_summary_stats, "output/native_sample_summary.csv")


################################
# 2. Counts of users by county #
################################

# See the README for instructions on how to access these data
sy_county_Ns <- read_csv("input/pipeline/individual_summary_sy_county_N.csv")
sy_loc_county_Ns <- read_csv("input/pipeline/individual_summary_sy_loc_county_N.csv")
native_county_Ns <- read_csv("input/pipeline/native_county_Ns.csv")

write_csv(sy_county_Ns, "output/syrian_county_Ns.csv")
write_csv(sy_loc_county_Ns, "output/syrian_loc_migrant_county_Ns.csv")
write_csv(native_county_Ns, "output/native_county_Ns.csv")


####################################################
# 3. Table of cross-group friendship concentration #
####################################################

# This produces Table 3

# See the README for instructions on how to access this data
frienders <- read_csv("input/pipeline/individual_summary_stats_frienders.csv")

write_csv(frienders, "output/friend_concentration.csv")
